package com.liang.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.liang.pojo.User;
import com.liang.service.UserService;

@Controller
public class UserController {
	/*
	 * @Autowired
	 * 
	 * @Qualifier("userServiceImpl") private UserService userService;
	 * 
	 * @RequestMapping("/login") public String userLogin(User user,String
	 * verifyInput,Model model, HttpSession session,HttpServletRequest
	 * request,HttpServletResponse response){ String username = user.getUsername();
	 * User user2 = userService.selectUserByUsername(username); if(user2!=null) {
	 * int password = user.getPassword(); int password2 = user2.getPassword();
	 * System.out.println("===========================");
	 * System.out.println(verifyInput);System.out.println(session.getAttribute(
	 * "verifyCode"));
	 * System.out.println(verifyInput.equals(session.getAttribute("verifyCode")));
	 * if(password-password2==0 &&
	 * verifyInput.equals(session.getAttribute("verifyCode"))) {
	 * session.setAttribute("info", username); return "main"; }else
	 * if(password-password2==0 &&
	 * !verifyInput.equals(session.getAttribute("verifyCode"))){
	 * model.addAttribute("msg2", "验证码错误"); return "toLogin"; }else {
	 * model.addAttribute("msg1", "密码错误"); return "toLogin"; } }else {
	 * model.addAttribute("msg", "用户名不存在"); return "toLogin"; } }
	 * 
	 * @RequestMapping("/toLogin") public String toLogin() { return "toLogin"; }
	 * 
	 * @RequestMapping("/user/main") public String main() { return "main"; }
	 * 
	 * @RequestMapping("/love/{username}") public String
	 * love(@PathVariable("username")String username,Model model) {
	 * model.addAttribute("username", username); return "love"; }
	 * 
	 * @RequestMapping("/zhuxiao") public String zhuxiao(HttpSession session,Model
	 * model) { session.invalidate(); return "toLogin"; }
	 */
}
